package com.imooc.business.core.executor.up;

import com.imooc.business.context.DataContext;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @Author Tim
 * @Description: 维度升级计算默认实现类
 * @Version 1.0
 */
@Slf4j
@Component
public class DefaultUpDimensionProcess implements UpDimensionProcess{
    private final EventProcess eventProcess;

    public DefaultUpDimensionProcess() {
        this.eventProcess = new EventProcessBuilder().
                addDecorator(LogEventProcessDecorator.class).
                build();
    }

    @Override
    public void up(DataContext context) {
        try {
            this.eventProcess.process(context);
        } catch (Exception e) {
            log.error("升级维度计算发生异常, e=",e);
        }
    }

}
